package com.dc.project_kotlin.ext

import android.view.View

fun View.visible() {
    visibility = View.VISIBLE
}

fun View.gone() {
    visibility = View.GONE
}

var lastClickTime = 0L
fun View.clickNoRepeat(interval: Long = 500, action: (view: View) -> Unit) {
    setOnClickListener {
        val currentTime = System.currentTimeMillis()
        if(lastClickTime != 0L && (currentTime - lastClickTime) < interval) {
            return@setOnClickListener
        }
        lastClickTime = currentTime
        action(it)
    }
}